﻿// GameLogic.h
#pragma once
#include "GameState.h"

class GameLogic {
public:
    explicit GameLogic(GameState& state) : gameState(state) {}

    void updateGameState(int x, int y);  // 更新游戏状态
    int checkGameOver(int x, int y);     // 检查游戏是否结束

private:
    GameState& gameState;

    void convertToGridPosition(int x, int y, int &gridX, int &gridY) const;
    [[nodiscard]] bool checkWin(int gridX, int gridY, char c) const;
    [[nodiscard]] bool checkDraw() const;
};
